from django.db import models
from django.utils import timezone

# Create your models here.


class UsersModel(models.Model):
    username = models.CharField(max_length=20,verbose_name='用户名',unique=True)
    mobile = models.CharField(max_length=11,verbose_name='手机号')
    password = models.CharField(max_length=32,verbose_name='密码')
    photo = models.CharField(max_length=128,verbose_name='头像')
    created_time = models.DateTimeField(verbose_name="注册时间", default=timezone.now)
    last_login = models.DateTimeField(verbose_name="最后登录时间", default=timezone.now)

    class Meta:
        verbose_name = "用户表"
        verbose_name_plural = verbose_name
        db_table = 'UsersModel'

    def __str__(self):
        return self.username
